﻿<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Financial Tracking</title>
<script src="${pageContext.request.contextPath}/js/jquery.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/jquery-ui.min.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/global.js" type="text/javascript"></script>

<link rel="stylesheet" href="${pageContext.request.contextPath}/css/jquery-ui.css" type="text/css" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/styles.css" type="text/css" />

<script>
	var DEFAULT_SCROLL = 34500;
	var loadingScroll = DEFAULT_SCROLL;
	var start = 0;
	var end = 1000;
	var cntAll = 0;
	var totalSalaryAmount = 0;
	var totalDischarge = 0;
	var totalChargeRule = 0;
	var totalCompensation = 0;
	
	var totalOrfHMain = 0;
	var totalOrfNHSO = 0;
	
	var totalSumHC = 0;
	var totalSumAE = 0;
	var totalSumINST = 0;
	var totalSumIP = 0;
	var totalSumDMIS = 0;
	var totalSumOP = 0;
	var totalSumPA = 0;
	var totalSumOT = 0;
	var totalSumDRUG = 0;
	
	var totalOldTotal = 0;
	var totalOldSumHC = 0;
	var totalOldSumAE = 0;
	var totalOldSumINST = 0;
	var totalOldSumIP = 0;
	var totalOldSumDMIS = 0;
	var totalOldSumOP = 0;
	var totalOldSumPA = 0;
	var totalOldSumOT = 0;
	var totalOldSumDRUG = 0;
	var totalOldAmount = 0;
	
	var totalNewSumHC = 0;
	var totalNewSumAE = 0;
	var totalNewSumINST = 0;
	var totalNewSumIP = 0;
	var totalNewSumDMIS = 0;
	var totalNewSumOP = 0;
	var totalNewSumPA = 0;
	var totalNewSumOT = 0;
	var totalNewSumDRUG = 0;
	var totalNewDischarge = 0;
	var totalNewCompensation = 0;
	
	var totalPay = 0;
	var totalReturn = 0;
	
	var countStatusA = 0;
	var rowspan_thead1 = "3453px";
	var rowspan_thead2 = "6050px";
	$(function() {
		$("head").append('<link rel="icon" type="image/icon" href="${pageContext.request.contextPath}/images/mini-icon.ico">');
		
		$("#txtFromDateAdmidTime,#txtToDateAdmidTime").datepicker({
			buttonImage : "${pageContext.request.contextPath}/images/calendar.gif"
		});
		
		$("#detailData").css("display","none");
		
		var selectZone = "กรุณาเลือกเขต";
		var selectProvince = "กรุณาเลือกจังหวัด";
		var selectHospital = "กรุณาเลือกหน่วยบริการ";
		
		$("#txtDataListProvince").html("<option value=''>"+ selectProvince+ "</option>");
		
		$("#txtDataListHospital").html("<option value='"+selectHospital+"'>"+ selectHospital+ "</option>");
		$("#txtDataListHospital").combobox();
		
		$(".custom-combobox-input").focusin(function(){
			$(this).val("");
		});		
		$(".custom-combobox-input").focusout(function(){
			var text = $( "#txtDataListHospital option:selected" ).text();
			$(this).val(text);
		});
		
		$.ajax({
			url : '${pageContext.request.contextPath}/master/getZone',
			type : "POST",
			success : function(data) {
				var datas = data.datas;
				var option = "<option value='' selected>"+ selectZone + "</option>";
				if(datas.length >0 ){
					$.each(data.datas,
							function(key, value) {
								var zoneId = value.zoneId;
								var zoneName = value.zoneName;
								option += "<option value='"+zoneId+"'>" + zoneName + "</option>";
					});
				}
				$("#txtDataListZone").html(option);
			}
		});
		
		$("#txtDataListZone").change(function(){
			var zoneId = $("#txtDataListZone option:selected").val();
			if(zoneId !== ""){
				$.ajax({
					url : '${pageContext.request.contextPath}/master/getProvince',
					data:{zoneId : zoneId},
					type : "POST",
					success : function(data) {
						var datas = data.datas;
						var option = "<option value='' selected>"+ selectProvince + "</option>";
						$.each(data.datas, function(key, value) {
							var provinceId = value.provinceCode;
							var provinceName = value.provinceName;
							option += "<option value='"+provinceId+"'>" + provinceName + "</option>";
						});
						$("#txtDataListProvince").html(option);
					}
				});
			}else{
				$("#txtDataListProvince").html("<option value='' selected>"+ selectZone + "</option>");
				$("#txtDataListHospital").html("<option value='"+selectHospital+"'>"+ selectHospital+ "</option>");
				$("#txtDataListHospital").combobox();
				$(".custom-combobox-input").val(selectHospital);
			}
		});
		
		
		$("#txtDataListProvince").change(function(){
			var zoneId = $("#txtDataListZone option:selected").val();
			var provinceId = $("#txtDataListProvince option:selected").val();
			if(provinceId !== "" && zoneId !== ""){
				$.getHospital(zoneId,provinceId,true);
			}else{
				$("#txtDataListHospital").html("<option value='"+selectHospital+"'>"+ selectHospital+ "</option>");
				$("#txtDataListHospital").combobox();
				$(".custom-combobox-input").val(selectHospital);
			}
			
		});
		
		
		$("#chkDunnoCode").click(function(){
			var check = $(this).prop('checked');
			if(check){
				$("#searchGroupHospital").show();
				$("#txtHospitalCode").attr("disabled",true);
				$("#txtHospitalCode").val("");
				$("#txtHospitalCode").css("background-color","#e7e7e7");
			}else{
				$("#searchGroupHospital").hide();
				$("#txtHospitalCode").attr("disabled",false);
				$("#txtHospitalCode").css("background-color","");
			}
		});
		
		$('#searchBy').change(function(){
			$("#txtSearch").val('');
		});
		
		
		$("#btnSearch").click(function() {
			if('${USER}'===''){
				$.loadpage(null, true);
			}else{
				var searchBy = $("#searchBy").val();
				var value = $.trim($("#txtSearch").val());
				if(value===''){
					$.alert('', 'โปรดระบุ ' + searchBy);
					return false;
				}
			
				var check = $("#chkDunnoCode").prop('checked');
				var hospitalCode = "";
				if("${USER.userType eq 'Hospital'}" == "true"){
					hospitalCode = "${USER.officeCode}";
				}else{
					if(check == true){
						if($("#txtDataListHospital").val()!=hospitalFirst){
							hospitalCode = $(".custom-combobox-input").val();
							var tmps = hospitalCode.split("-");
							hospitalCode = $.trim(tmps[0]);
						}else{
							hospitalCode = "";
						}
					}else{
						hospitalCode = $("#txtHospitalCode").val();
					}
				}
				var dateFromAdmid = formatStrDate($("#txtFromDateAdmidTime").val());
				var dateToAdmid = formatStrDate($("#txtToDateAdmidTime").val());
				dateFromAdmid = !dateFromAdmid ? '' : dateFromAdmid;
				dateToAdmid = !dateToAdmid ? '' : dateToAdmid;
				start = 0;
				end = 1000;
				$.ajax({
					url : '${pageContext.request.contextPath}/summarypid/searchByPID',
					type : 'POST',
					data : {
						searchBy : searchBy,
						value : value,
						hospitalCode : $.trim(hospitalCode),
						dateFromAdmidTime : dateFromAdmid,
						dateToAdmidTime : dateToAdmid,
						start: start,
						end: end
					},
					success : function(data) {
						if(data.success){
							var arrays = data.datas;
							$("#tbBodyData tbody").html('');
							appendHTMLData(arrays, $("#tbBodyData tbody").html(), false);
						}else{
							$("#detailData").css("display","none");
							$.alert('', 'ไม่มีข้อมูล');
							$("#tbBodyData tbody").html('<tr><td colspan="30" class="required">ไม่มีข้อมูล</td></tr>');
						}
					}
				});
			}
		});
		
		$('#tbValueData').scroll( function() {
			var fromtop = $(this).scrollTop();

			if (fromtop > loadingScroll) {
				loadingScroll += DEFAULT_SCROLL;
				var searchBy = $("#searchBy").val();
				var value = $.trim($("#txtSearch").val());
				if(value===''){
					$.alert('', 'โปรดระบุ ' + searchBy);
					return false;
				}
			
				var check = $("#chkDunnoCode").prop('checked');
				var hospitalCode = "";
				if("${USER.userType eq 'Hospital'}" == "true"){
					hospitalCode = "${USER.officeCode}";
				}else{
					if(check == true){
						if($("#txtDataListHospital").val()!=hospitalFirst){
							hospitalCode = $(".custom-combobox-input").val();
							var tmps = hospitalCode.split("-");
							hospitalCode = $.trim(tmps[0]);
						}else{
							hospitalCode = "";
						}
					}else{
						hospitalCode = $("#txtHospitalCode").val();
					}
				}
				var dateFromAdmid = formatStrDate($("#txtFromDateAdmidTime").val());
				var dateToAdmid = formatStrDate($("#txtToDateAdmidTime").val());
				dateFromAdmid = !dateFromAdmid ? '' : dateFromAdmid;
				dateToAdmid = !dateToAdmid ? '' : dateToAdmid;
				start += 1000;
				end += 1000;
				$.ajax({
					url: '${pageContext.request.contextPath}/summary/details/data/getListDetails',
					data : {
						searchBy : searchBy,
						value : value,
						hospitalCode : $.trim(hospitalCode),
						dateFromAdmidTime : dateFromAdmid,
						dateToAdmidTime : dateToAdmid,
						start: start,
						end: end
					},
					type: 'POST',
					success:function(data){
						if(data.success){
							var arrays = data.datas;
							appendHTMLData(arrays, $("#tbBodyData tbody").html(), false);
						}else{
							$("#tbBodyData tbody").html('<tr><td colspan="30" class="required">ไม่มีข้อมูล</td></tr>');
						}
					}
				});
			}
		});
	});

	var hospitalFirst = "กรุณาเลือกหน่วยบริการ";
	$.getHospital = function(zoneId, provinceId, async) {
		$.ajax({
			url : '${pageContext.request.contextPath}/master/getHospital',
			type : "POST",
			data:{zoneId : zoneId, provinceId : provinceId},
			async : async,
			success : function(data) {
				if (data.success) {
					if (data.code === "0000") {
						datas = data.datas;
						var option = "<option value='" + hospitalFirst + "' selected>" + hospitalFirst + "</option>";
						var selected = "";
						$.each(data.datas, function(key, value) {
							var len = value.hospitalCode.length;
							var hospitalCode = value.hospitalCode.substring(len - 5, len);
							option += "<option value='" + hospitalCode + " - " + value.hospitalName + "'>" + hospitalCode
									+ " - " + value.hospitalName + "</option>";
						});
						$("#txtDataListHospital").html("");
						$("#txtDataListHospital").html(option);
						$("#txtDataListHospital").combobox();
					}
				} else {
					$.alert("ERROR" + data.code, data.msg);
				}
			}
		});	
	};
	
	//Set New function of table
	$(function(){
		$("#hide_table").hide();
		$("#tbValueData").css("height","410px");
		$(".hidden-table").hide();
		$("#thead2").hide();
		
		$("#tbHeaderData").attr("width",rowspan_thead1);
		$("#tbBodyData").attr("width",rowspan_thead1);
		
		$("#show_table").click(function(){

			$("#tbHeaderData").attr("width",rowspan_thead2);
			$("#tbBodyData").attr("width",rowspan_thead2);
			
			$("#tbValueData").css("height","390px");
			
			$("#thead1").hide();
			$("#thead2").show();
			
			$(".hidden-table").show();
			
			$("#show_table").hide();
			$("#hide_table").show();
		});
		
		$("#hide_table").click(function(){
			hideTable();
		});
		
		$('#exportExcel').click(function(){
			var pid = $('#pid').html();
			window.open('${pageContext.request.contextPath}/summarypid/' + pid);
		});
	});
	
	
	
	function hideTable(){
		$("#tbHeaderData").attr("width",rowspan_thead1);
		$("#tbBodyData").attr("width",rowspan_thead1);
		
		$("#tbValueData").css("height","410px");
		
		$("#thead1").show();
		$("#thead2").hide();
		
		$(".hidden-table").hide();
		
		$("#show_table").show();
		$("#hide_table").hide();
	}
	
	function appendHTMLData(arrays, tb, fromLoad){
		hideTable();
		$('#countAll').html(arrays.countAll);
		$('#countPass').html(arrays.countPass);
		$('#countAppeal').html(arrays.countAppeal);
		$('#countNotPass').html(arrays.countNotPass);
		$('#countNotPassDeny').html(arrays.countNotPassDeny);
		var searchByValue = $('#searchBy').val();
		if(searchByValue === 'pid'){
			$('#searchByValueData').show();
		}else{
			$('#searchByValueData').hide();
		}
		arrays = arrays.pidDatas;
		if(arrays !== null && arrays.length > 0){
			for(var i in arrays){
				var obj = arrays[i];
				var val = '';
				if(searchByValue === 'pid'){
					val = obj.pid;
					$('#searchByValue').html('PID');
				}else if(searchByValue === 'hn'){
					val = obj.hn;
					$('#searchByValue').html('HN');
				}else if(searchByValue === 'an'){
					val = obj.an;
					$('#searchByValue').html('AN');
				}
				$('#pid').html(val);
				$('#fullname').html(obj.fullname);
				//actAmount += obj.compensation;
				//sumsTotal += obj.discharge;
				
				var codeDWHC = nullToEmpty(obj.codeDWHC);
				var codeDWINST = nullToEmpty(obj.codeDWINST);
				var codeDWAE = nullToEmpty(obj.codeDWAE);
				var codeDWIP = nullToEmpty(obj.codeDWIP);
				var codeDWDMIS = nullToEmpty(obj.codeDWDMIS);
				var sumsHC = obj.sumsHC;
				var sumsAE = obj.sumsAE;
				var sumsINST = obj.sumsINST;
				var sumsIP = obj.sumsIP;
				var sumsDMIS = obj.sumsDMIS;
				var sumsDRUG = obj.sumsDRUG;
				
				var codeDWIPCSLG = nullToEmpty(obj.codeDWIPCSLG);
				var codeDWOPCSLG = nullToEmpty(obj.codeDWOPCSLG);
				var codePACSLG = nullToEmpty(obj.codeDWPACSLG);
				var codeINSTCSLG = nullToEmpty(obj.codeDWINSTCSLG);
				var codeOTCSLG = nullToEmpty(obj.codeDWOTCSLG);
				var sumsIPCS = obj.sumsIPCS;
				var sumsOPCS = obj.sumsOPCS;
				var sumsPACS = obj.sumsPACS;
				var sumsINSTCS = obj.sumsINSTCS;
				var sumsOTCS = obj.sumsOTCS;
				var sumsDRUGCS = obj.sumsDRUGCS;
				
				var statusType = "";
				if(obj.statusType==='C' || obj.statusType==='X'){
					statusType = "ตรวจสอบชดเชย";
				}else if(obj.statusType==='E' || obj.statusType==='Y'){
					statusType = "อนุมัติจ่ายชดเชย";
				}else if(obj.statusType==='B'){
					statusType = "ตัดงบประมาณ";
				}else if(obj.statusType==='P'){
					statusType = "ตั้งหนี้";
				}else if(obj.statusType==='T'){
					statusType = "ตัดจ่าย";
				}
				
				var status = 'ผ่าน';
				var clazz = '';
				var classTD = '';
				
				if(obj.status === 'A'){
					status = 'อุทธรณ์';
				}else if(obj.status === 'ND'){
					var statusDeny = '';
					
					if(codeDWHC !== '' && codeDWHC !== 'C' && codeDWHC !== 'N'){
						statusDeny += codeDWHC;
					}
					if(codeDWINST !== '' && codeDWINST !== 'C' && codeDWINST !== 'N'){
						if(statusDeny !== ''){
							statusDeny += ', ';
						}
						statusDeny += codeDWINST;
					}
					if(codeDWAE !== '' && codeDWAE !== 'C' && codeDWAE !== 'N'){
						if(statusDeny !== ''){
							statusDeny += ', ';
						}
						statusDeny += codeDWAE;
					}
					if(codeDWIP !== '' && codeDWIP !== 'C' && codeDWIP !== 'N'){
						if(statusDeny !== ''){
							statusDeny += ', ';
						}
						statusDeny += codeDWIP;
					}
					if(codeDWDMIS !== '' && codeDWDMIS !== 'C' && codeDWDMIS !== 'N'){
						if(statusDeny !== ''){
							statusDeny += ', ';
						}
						statusDeny += codeDWDMIS;
					}
					if(codeDWIPCSLG !== '' && codeDWIPCSLG !== 'C' && codeDWIPCSLG !== 'N'){
						if(statusDeny !== ''){
							statusDeny += ', ';
						}
						statusDeny += codeDWIPCSLG;
					}
					if(codeDWOPCSLG !== '' && codeDWOPCSLG !== 'C' && codeDWOPCSLG !== 'N'){
						if(statusDeny !== ''){
							statusDeny += ', ';
						}
						statusDeny += codeDWOPCSLG;
					}
					if(codePACSLG !== '' && codePACSLG !== 'C' && codePACSLG !== 'N'){
						if(statusDeny !== ''){
							statusDeny += ', ';
						}
						statusDeny += codePACSLG;
					}
					if(codeINSTCSLG !== '' && codeINSTCSLG !== 'C' && codeINSTCSLG !== 'N'){
						if(statusDeny !== ''){
							statusDeny += ', ';
						}
						statusDeny += codeINSTCSLG;
					}
					if(codeOTCSLG !== '' && codeOTCSLG !== 'C' && codeOTCSLG !== 'N'){
						if(statusDeny !== ''){
							statusDeny += ', ';
						}
						statusDeny += codeOTCSLG;
					}
					
					status = 'ไม่เข้าเกณฑ์<br>(' + statusDeny + ')';
					classTD = 'required';
				}else if(obj.status === 'N'){
					var statusDeny = '';
					var tmps = obj.codeId.split(",");
					for(var j=0; j<tmps.length; j++){
						if(j === 0){
							statusDeny += 'C' + tmps[j];
						}else{
							statusDeny += ', C' + tmps[j];
						}
					}
					status = 'ไม่ผ่าน<br>(' + statusDeny + ')';
					classTD = 'required';
				}
				
				if(obj.orf === 'Y'){
					status += '<br>(ORF)*';
					if('${SESSION_SUMMARY.pageDetailsData.status}' === 'transfer'){
						$("#orfTransfer").html("*หมายเหตุ ORF=เบิกจ่ายจากต้นสังกัด");
					}else{
						$("#orf").html("*หมายเหตุ ORF=เบิกจ่ายจากต้นสังกัด");
					}
				}
				
				var totalDisCom = obj.discharge - obj.compensation;
				var clazzDisCom = '';
				if(totalDisCom < 0){
					clazzDisCom = 'required';
				}
				var cnt = parseInt(i)+1;
				tb += '<tr class="' + clazz + '" id="' + obj.pid + '" title="' + obj.pid + ' ' + obj.fullname + '">';
				tb += '<td width="40px">' + cnt + '</td>';
				tb += '<td width="100px">' + nullToEmpty(obj.tranId) + '&nbsp;</td>';
				tb += '<td width="100px">' + nullToEmpty(obj.eclaimNo) + '&nbsp;</td>';
				tb += '<td width="70px"><span style="width: 70px">' + nullToEmpty(obj.hn) + '</span></td>';
				tb += '<td width="70px"><span style="width: 70px">' + nullToEmpty(obj.an) + '</span></td>';
				tb += '<td width="70px">' + nullToEmpty(obj.repNo) + '</td>';
				tb += '<td width="50px">' + nullToEmpty(obj.personType) + '</td>';
				tb += '<td width="180px" align="left"><span style="width: 180px">&nbsp;' + nullToEmpty(obj.hospitalName) + '</span></td>';
				tb += '<td width="110px">' + nullToEmpty(obj.admidDate) + '&nbsp;' + nullToEmpty(obj.admidTime) + '</td>';
				tb += '<td width="110px">' + nullToEmpty(obj.dischargeDate) + '&nbsp;' + nullToEmpty(obj.dischargeTime) + '</td>';
				tb += '<td width="70px">' + nullToEmpty(obj.salaryPercent) + '</td>';						
				tb += '<td width="100px" align="right">' + nullToEmpty(currency2Digit(obj.salaryAmount)) + '&nbsp;</td>';
				tb += '<td width="100px" align="right">' + nullToEmpty(currency2Digit(obj.discharge)) + '&nbsp;</td>';
				tb += '<td width="60px" class="' + classTD + '">' + nullToEmpty(status) + '</td>';								
				tb += '<td width="100px" align="right">' + nullToEmpty(currency2Digit(obj.chargeRule)) + '&nbsp;</td>';
				tb += '<td width="100px" align="right">' + nullToEmpty(currency2Digit(obj.compensation)) + '&nbsp;</td>';									
				tb += '<td width="100px" align="right" class="' + clazzDisCom + '">' + nullToEmpty(currency2Digit(totalDisCom)) + '&nbsp;</td>';
				tb += '<td width="70px">' + nullToEmpty(obj.batchId) + '</td>';
				tb += '<td width="120px">' + nullToEmpty(obj.paymentDate) + '</td>';
				tb += '<td width="100px">' + statusType + '</td>';
				tb += '<td width="70px">' + nullToEmpty(obj.authType) + '</td>';
				tb += '<td width="100px" align="right">' + nullToEmpty(currency2Digit(obj.orfHMain)) + '&nbsp;</td>';			
				tb += '<td width="100px" align="right">' + nullToEmpty(currency2Digit(obj.orfNHSO)) + '&nbsp;</td>';			
				
				if(codeDWHC === 'C'){
					if(sumsHC !== null && sumsHC !== 0){
						tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsHC) + '">' + currency2Digit(sumsHC) + '&nbsp;</td>';
						totalSumHC += sumsHC;
					}else{
						tb += '<td width="100px">&nbsp;</td>';
					}
				}else if(codeDWHC === 'N'){
					tb += '<td width="100px">&nbsp;</td>';
				}else if(codeDWHC !== ''){
					tb += '<td width="100px">' + codeDWHC + '&nbsp;</td>';
				}else{
					tb += '<td width="100px">&nbsp;</td>';
				}		
				if(codeDWAE === 'C'){
					if(sumsAE !== null && sumsAE !== 0){
						tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsAE) + '">' + currency2Digit(sumsAE) + '&nbsp;</td>';
						totalSumAE += sumsAE;
					}else{
						tb += '<td width="100px">&nbsp;</td>';
					}
				}else if(codeDWAE === 'N'){
					tb += '<td width="100px">&nbsp;</td>';
				}else if(codeDWAE !== ''){
					tb += '<td width="100px">' + codeDWAE + '&nbsp;</td>';
				}else{
					tb += '<td width="100px">&nbsp;</td>';
				}
				
				if(codeDWINST === 'C'){
					if(sumsINST !== null && sumsINST !== 0){
						tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsINST) + '">' + currency2Digit(sumsINST) + '&nbsp;</td>';
						totalSumINST += sumsINST;
					}else{
						tb += '<td width="100px">&nbsp;</td>';
					}
				}else if(codeDWINST === 'N'){
					tb += '<td width="100px">&nbsp;</td>';
				}else if(codeDWINST !== ''){
					tb += '<td width="100px">' + codeDWINST + '&nbsp;</td>';
				}else{
					if(codeINSTCSLG === 'C'){
						if(sumsINSTCS !== null && sumsINSTCS !== 0){
							tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsINSTCS) + '">' + currency2Digit(sumsINSTCS) + '&nbsp;</td>';
							totalSumINST += sumsINSTCS;
						}else{
							tb += '<td width="100px">&nbsp;</td>';
						}
					}else if(codeINSTCSLG === 'N'){
						tb += '<td width="100px">&nbsp;</td>';
					}else{
						tb += '<td width="100px">' + codeINSTCSLG + '&nbsp;</td>';
					}
				}
				
				if(codeDWIP === 'C'){
					if(sumsIP !== null && sumsIP !== 0){
						tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsIP) + '">' + currency2Digit(sumsIP) + '&nbsp;</td>';
						totalSumIP += sumsIP;
					}else{
						tb += '<td width="100px">&nbsp;</td>';
					}
				}else if(codeDWIP === 'N'){
					tb += '<td width="100px">&nbsp;</td>';
				}else if(codeDWIP !== ''){
					tb += '<td width="100px">' + codeDWIP + '&nbsp;</td>';
				}else{
					if(codeDWIPCSLG === 'C'){
						if(sumsIPCS !== null && sumsIPCS !== 0){
							tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsIPCS) + '">' + currency2Digit(sumsIPCS) + '&nbsp;</td>';
							totalSumIP += sumsIPCS;
						}else{
							tb += '<td width="100px">&nbsp;</td>';
						}
					}else if(codeDWIPCSLG === 'N'){
						tb += '<td width="100px">&nbsp;</td>';
					}else{
						tb += '<td width="100px">' + codeDWIPCSLG + '&nbsp;</td>';
					}
				}
				if(codeDWDMIS === 'C'){
					if(sumsDMIS !== null && sumsDMIS !== 0){
						tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsDMIS) + '">' + currency2Digit(sumsDMIS) + '&nbsp;</td>';
						totalSumDMIS += sumsDMIS;
					}else{
						tb += '<td width="100px">&nbsp;</td>';
					}
				}else if(codeDWDMIS === 'N'){
					tb += '<td width="100px">&nbsp;</td>';
				}else if(codeDWDMIS !== ''){
					tb += '<td width="100px">' + codeDWDMIS + '&nbsp;</td>';
				}else{
					tb += '<td width="100px">&nbsp;</td>';
				}
					
				if(codeDWOPCSLG === 'C'){
					if(sumsOPCS !== null && sumsOPCS !== 0){
						tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsOPCS) + '">' + currency2Digit(sumsOPCS) + '&nbsp;</td>';
						totalSumOP += sumsOPCS;
					}else{
						tb += '<td width="100px">&nbsp;</td>';
					}
				}else if(codeDWOPCSLG === 'N'){
					tb += '<td width="100px">&nbsp;</td>';
				}else if(codeDWOPCSLG !== ''){
					tb += '<td width="100px">' + codeDWOPCSLG + '&nbsp;</td>';
				}else{
					tb += '<td width="100px">&nbsp;</td>';
				}
				
				if(codePACSLG === 'C'){
					if(sumsPACS !== null && sumsPACS !== 0){
						tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsPACS) + '">' + currency2Digit(sumsPACS) + '&nbsp;</td>';
						totalSumPA += sumsPACS;
					}else{
						tb += '<td width="100px">&nbsp;</td>';
					}
				}else if(codePACSLG === 'N'){
					tb += '<td width="100px">&nbsp;</td>';
				}else if(codePACSLG !== ''){
					tb += '<td width="100px">' + codePACSLG + '&nbsp;</td>';
				}else{
					tb += '<td width="100px">&nbsp;</td>';
				}
				
				if((sumsDRUG !== null && sumsDRUG !== 0) && (codeDWIP === 'N' || codeDWIP === 'C')){
					tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsDRUG) + '">' + currency2Digit(sumsDRUG) + '&nbsp;</td>';
					totalSumDRUG += sumsDRUG;
				}else if((sumsDRUGCS !== null && sumsDRUGCS !== 0) && (codeDWIPCSLG === 'N' || codeDWIPCSLG === 'C')){
					tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsDRUGCS) + '">' + currency2Digit(sumsDRUGCS) + '&nbsp;</td>';
					totalSumDRUG += sumsDRUGCS;
				}else{
					tb += '<td width="100px">&nbsp;</td>';
				}
				
				if(codeOTCSLG === 'C'){
					if(sumsOTCS !== null && sumsOTCS !== 0){
						tb += '<td width="100px" class="amount" title="' + currency2Digit(sumsOTCS) + '">' + currency2Digit(sumsOTCS) + '&nbsp;</td>';
						totalSumOT += sumsOTCS;
					}else{
						tb += '<td width="100px">&nbsp;</td>';
					}
				}else if(codeOTCSLG === 'N'){
					tb += '<td width="100px">&nbsp;</td>';
				}else if(codeOTCSLG !== ''){
					tb += '<td width="100px">' + codeOTCSLG + '&nbsp;</td>';
				}else{
					tb += '<td width="100px">&nbsp;</td>';
				}
				
				if(obj.status !== 'A'){
					/*tb += '<td width="100px" style="border-right: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff; color: blue" align="right" class="hidden-table">&nbsp;ไม่มีอุทธรณ์</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-left: 1px solid #ffffff; color: blue" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff; color: blue" align="right" class="hidden-table">&nbsp;ไม่มีอุทธรณ์</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-right: 1px solid #ffffff;border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';
					tb += '<td width="100px" style="border-left: 1px solid #ffffff;" align="right" class="hidden-table">&nbsp;</td>';*/
					tb += '<td style="color: blue" colspan="11" class="hidden-table">&nbsp;ไม่มีอุทธรณ์</td>';
					tb += '<td style="color: blue" colspan="11" class="hidden-table">&nbsp;ไม่มีอุทธรณ์</td>';
					tb += '<td style="color: blue" style="width:100px" class="hidden-table">&nbsp;</td>';
					tb += '<td style="color: blue" style="width:100px" class="hidden-table">&nbsp;</td>';
				}else{
					var oldCodeDWHC = nullToEmpty(obj.oldCodeDWHC);
					var oldCodeDWINST = nullToEmpty(obj.oldCodeDWINST);
					var oldCodeDWAE = nullToEmpty(obj.oldCodeDWAE);
					var oldCodeDWIP = nullToEmpty(obj.oldCodeDWIP);
					var oldCodeDWDMIS = nullToEmpty(obj.oldCodeDWDMIS);
					var oldSumsHC = obj.oldSumsHC;
					var oldSumsAE = obj.oldSumsAE;
					var oldSumsINST = obj.oldSumsINST;
					var oldSumsIP = obj.oldSumsIP;
					var oldSumsDMIS = obj.oldSumsDMIS;
					var oldSumsDRUG = obj.oldSumsDRUG;
					
					var oldCodeDWIPCSLG = nullToEmpty(obj.oldCodeDWIPCSLG);
					var oldCodeDWOPCSLG = nullToEmpty(obj.oldCodeDWOPCSLG);
					var oldCodeDWPACSLG = nullToEmpty(obj.oldCodeDWPACSLG);
					var oldCodeDWINSTCSLG = nullToEmpty(obj.oldCodeDWINSTCSLG);
					var oldCodeDWOTCSLG = nullToEmpty(obj.oldCodeDWOTCSLG);
					var oldSumsIPCS = obj.sumsIPCS;
					var oldSumsOPCS = obj.sumsOPCS;
					var oldSumsPACS = obj.sumsPACS;
					var oldSumsINSTCS = obj.sumsINSTCS;
					var oldSumsOTCS = obj.sumsOTCS;
					var oldSumsDRUGCS = obj.sumsDRUGCS;
				
					tb += '<td width="100px" style="text-align:right" class="hidden-table">' + nullToEmpty(currency2Digit(obj.oldDischarge)) + '&nbsp;</td>';
					totalOldTotal += obj.oldDischarge;
					
					if(oldCodeDWHC === 'C'){
						if(oldSumsHC !== null && oldSumsHC !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsHC) + '">' + currency2Digit(oldSumsHC) + '&nbsp;</td>';
							totalOldSumHC += oldSumsHC;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(oldCodeDWHC === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(oldCodeDWHC !== ''){
						tb += '<td width="100px"  class="hidden-table">' + oldCodeDWHC + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					
					if(oldCodeDWAE === 'C'){
						if(oldSumsAE !== null && oldSumsAE !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsAE) + '">' + currency2Digit(oldSumsAE) + '&nbsp;</td>';
							totalOldSumAE += oldSumsAE;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(oldCodeDWAE === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(oldCodeDWAE !== ''){
						tb += '<td width="100px"  class="hidden-table">' + oldCodeDWAE + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					
					if(oldCodeDWINST === 'C'){
						if(oldSumsINST !== null && oldSumsINST !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsINST) + '">' + currency2Digit(oldSumsINST) + '&nbsp;</td>';
							totalOldSumINST += oldSumsINST;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(oldCodeDWINST === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(oldCodeDWINST !== ''){
						tb += '<td width="100px"  class="hidden-table">' + oldCodeDWINST + '&nbsp;</td>';
					}else{
						if(oldCodeDWINSTCSLG === 'C'){
							if(oldSumsINSTCS !== null && oldSumsINSTCS !== 0){
								tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsINSTCS) + '">' + currency2Digit(oldSumsINSTCS) + '&nbsp;</td>';
								totalOldSumINST += oldSumsINSTCS;
							}else{
								tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
							}
						}else if(oldCodeDWINSTCSLG === 'N'){
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}else{
							tb += '<td width="100px"  class="hidden-table">' + oldCodeDWINSTCSLG + '&nbsp;</td>';
						}
					}
					
					if(oldCodeDWIP === 'C'){
						if(oldSumsIP !== null && oldSumsIP !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsIP) + '">' + currency2Digit(oldSumsIP) + '&nbsp;</td>';
							totalOldSumIP += oldSumsIP;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(oldCodeDWIP === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(oldCodeDWIP !== ''){
						tb += '<td width="100px"  class="hidden-table">' + oldCodeDWIP + '&nbsp;</td>';
					}else{
						if(oldCodeDWIPCSLG === 'C'){
							if(oldSumsIPCS !== null && oldSumsIPCS !== 0){
								tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsIPCS) + '">' + currency2Digit(oldSumsIPCS) + '&nbsp;</td>';
								totalOldSumIP += oldSumsIPCS;
							}else{
								tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
							}
						}else if(oldCodeDWIPCSLG === 'N'){
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}else{
							tb += '<td width="100px"  class="hidden-table">' + oldCodeDWIPCSLG + '&nbsp;</td>';
						}
					}
					
					if(oldCodeDWDMIS === 'C'){
						if(oldSumsDMIS !== null && oldSumsDMIS !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsDMIS) + '">' + currency2Digit(oldSumsDMIS) + '&nbsp;</td>';
							totalOldSumDMIS += oldSumsDMIS;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(oldCodeDWDMIS === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(oldCodeDWDMIS !== ''){
						tb += '<td width="100px"  class="hidden-table">' + oldCodeDWDMIS + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					
					if(oldCodeDWOPCSLG === 'C'){
						if(oldSumsOPCS !== null && oldSumsOPCS !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsOPCS) + '">' + currency2Digit(oldSumsOPCS) + '&nbsp;</td>';
							totalOldSumOP += oldSumsOPCS;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(oldCodeDWOPCSLG === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(oldCodeDWOPCSLG !== ''){
						tb += '<td width="100px"  class="hidden-table">' + oldCodeDWOPCSLG + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					
					if(oldCodeDWPACSLG === 'C'){
						if(oldSumsPACS !== null && oldSumsPACS !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsPACS) + '">' + currency2Digit(oldSumsPACS) + '&nbsp;</td>';
							totalOldSumPA += oldSumsPACS;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(oldCodeDWPACSLG === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(oldCodeDWPACSLG !== ''){
						tb += '<td width="100px"  class="hidden-table">' + oldCodeDWPACSLG + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					
					if(oldSumsDRUG !== null && oldSumsDRUG !== 0){
						tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsDRUG) + '">' + currency2Digit(oldSumsDRUG) + '&nbsp;</td>';
						totalOldSumDRUG += oldSumsDRUG;
					}else if(oldSumsDRUGCS !== null && oldSumsDRUGCS !== 0){
						tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsDRUGCS) + '">' + currency2Digit(oldSumsDRUGCS) + '&nbsp;</td>';
						totalOldSumDRUG += oldSumsDRUGCS;
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					
					if(oldCodeDWOTCSLG === 'C'){
						if(oldSumsOTCS !== null && oldSumsOTCS !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(oldSumsOTCS) + '">' + currency2Digit(oldSumsOTCS) + '&nbsp;</td>';
							totalOldSumOT += oldSumsOTCS;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(oldCodeDWOTCSLG === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(oldCodeDWOTCSLG !== ''){
						tb += '<td width="100px  class="hidden-table"">' + oldCodeDWOTCSLG + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					tb += '<td width="100px" style="text-align:right"  class="hidden-table">' + nullToEmpty(currency2Digit(obj.oldCompensation)) + '&nbsp;</td>';
					totalOldAmount += obj.oldCompensation;	
					
					tb += '<td width="100px" style="text-align:right"  class="hidden-table">' + nullToEmpty(currency2Digit(obj.discharge)) + '&nbsp;</td>';	
					totalNewDischarge += obj.discharge;				
					if(codeDWHC === 'C'){
						if(sumsHC !== null && sumsHC !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsHC) + '">' + currency2Digit(sumsHC) + '&nbsp;</td>';
							totalNewSumHC += sumsHC;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(codeDWHC === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(codeDWHC !== ''){
						tb += '<td width="100px"  class="hidden-table">' + codeDWHC + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
								
					if(codeDWAE === 'C'){
						if(sumsAE !== null && sumsAE !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsAE) + '">' + currency2Digit(sumsAE) + '&nbsp;</td>';
							totalNewSumAE += sumsAE;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(codeDWAE === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(codeDWAE !== ''){
						tb += '<td width="100px"  class="hidden-table">' + codeDWAE + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					
					if(codeDWINST === 'C'){
						if(sumsINST !== null && sumsINST !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsINST) + '">' + currency2Digit(sumsINST) + '&nbsp;</td>';
							totalNewSumINST += sumsINST;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(codeDWINST === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(codeDWINST !== ''){
						tb += '<td width="100px"  class="hidden-table">' + codeDWINST + '&nbsp;</td>';
					}else{
						if(codeINSTCSLG === 'C'){
							if(sumsINSTCS !== null && sumsINSTCS !== 0){
								tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsINSTCS) + '">' + currency2Digit(sumsINSTCS) + '&nbsp;</td>';
								totalNewSumINST += sumsINSTCS;
							}else{
								tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
							}
						}else if(codeINSTCSLG === 'N'){
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}else{
							tb += '<td width="100px"  class="hidden-table">' + codeINSTCSLG + '&nbsp;</td>';
						}
					}
					
					if(codeDWIP === 'C'){
						if(sumsIP !== null && sumsIP !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsIP) + '">' + currency2Digit(sumsIP) + '&nbsp;</td>';
							totalNewSumIP += sumsIP;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(codeDWIP === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(codeDWIP !== ''){
						tb += '<td width="100px"  class="hidden-table">' + codeDWIP + '&nbsp;</td>';
					}else{
						if(codeDWIPCSLG === 'C'){
							if(sumsIPCS !== null && sumsIPCS !== 0){
								tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsIPCS) + '">' + currency2Digit(sumsIPCS) + '&nbsp;</td>';
								totalNewSumIP += sumsIPCS;
							}else{
								tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
							}
						}else if(codeDWIPCSLG === 'N'){
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}else{
							tb += '<td width="100px"  class="hidden-table">' + codeDWIPCSLG + '&nbsp;</td>';
						}
					}
					
					if(codeDWDMIS === 'C'){
						if(sumsDMIS !== null && sumsDMIS !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsDMIS) + '">' + currency2Digit(sumsDMIS) + '&nbsp;</td>';
							totalNewSumDMIS += sumsDMIS;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(codeDWDMIS === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(codeDWDMIS !== ''){
						tb += '<td width="100px"  class="hidden-table">' + codeDWDMIS + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					
					if(codeDWOPCSLG === 'C'){
						if(sumsOPCS !== null && sumsOPCS !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsOPCS) + '">' + currency2Digit(sumsOPCS) + '&nbsp;</td>';
							totalNewSumOP += sumsOPCS;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(codeDWOPCSLG === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(codeDWOPCSLG !== ''){
						tb += '<td width="100px"  class="hidden-table">' + codeDWOPCSLG + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
						
					if(codePACSLG === 'C'){
						if(sumsPACS !== null && sumsPACS !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsPACS) + '">' + currency2Digit(sumsPACS) + '&nbsp;</td>';
							totalNewSumPA += sumsPACS;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(codePACSLG === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(codePACSLG !== ''){
						tb += '<td width="100px"  class="hidden-table">' + codePACSLG + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					
					if(sumsDRUG !== null && sumsDRUG !== 0){
						tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsDRUG) + '">' + currency2Digit(sumsDRUG) + '&nbsp;</td>';
						totalNewSumDRUG += sumsDRUG;
					}else if(sumsDRUGCS !== null && sumsDRUGCS !== 0){
						tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsDRUGCS) + '">' + currency2Digit(sumsDRUGCS) + '&nbsp;</td>';
						totalNewSumDRUG += sumsDRUG;
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}
					
					if(codeOTCSLG === 'C'){
						if(sumsOTCS !== null && sumsOTCS !== 0){
							tb += '<td width="100px" class="amount hidden-table" title="' + currency2Digit(sumsOTCS) + '">' + currency2Digit(sumsOTCS) + '&nbsp;</td>';
							totalNewSumOT += sumsOTCS;
						}else{
							tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
						}
					}else if(codeOTCSLG === 'N'){
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}else if(codeOTCSLG !== ''){
						tb += '<td width="100px  class="hidden-table"">' + codeOTCSLG + '&nbsp;</td>';
					}else{
						tb += '<td width="100px"  class="hidden-table">&nbsp;</td>';
					}				
					tb += '<td width="100px" style="text-align:right"  class="hidden-table">' + nullToEmpty(currency2Digit(obj.compensation)) + '&nbsp;</td>';
					totalNewCompensation += obj.compensation;
					
					var amnt = obj.oldCompensation - obj.compensation;
					var pay = 0;
					var payReturn = 0;
					if(amnt < 0){
						pay = obj.compensation - obj.oldCompensation;
						payReturn = 0;
					}else{
						pay = 0;
						payReturn = amnt;
					}
					
					tb += '<td width="100px" style="text-align:right" class="hidden-table">' + currency2Digit(pay) + '&nbsp;</td>';
					tb += '<td width="100px" style="text-align:right" class="hidden-table">' + currency2Digit(payReturn) + '&nbsp;</td>';
					
					countStatusA += 1;
					
					amnt = obj.oldCompensation - obj.compensation;
					pay = 0;
					payReturn = 0;
					if(amnt < 0){
						pay = obj.compensation - obj.oldCompensation;
					}else{
						payReturn = amnt;
					}
					totalPay += pay;
					totalReturn += payReturn;
				}
				tb += '</tr>';
				
				totalSalaryAmount += obj.salaryAmount;
				totalDischarge += obj.discharge;
				totalChargeRule += obj.chargeRule;
				totalCompensation += obj.compensation;
				
				totalOrfHMain += obj.orfHMain;
				totalOrfNHSO += obj.orfNHSO;
			}
			
			var totalDisComTotal = totalDischarge - totalCompensation;
			var clazzDisComTotal = '';
			if(totalDisComTotal < 0){
				clazzDisComTotal = 'required';
			}
			
			if(end >= cntAll){
			tb += '<tr style="background-color: rgb(224,224,224);">';
			tb += '<td colspan="10" style="text-align: center"><strong>รวม</strong>&nbsp;</td>';
			tb += '<td width="70px"></td>';
			tb += '<td width="100px" align="right">' + currency2Digit(totalSalaryAmount) + '&nbsp;</td>';
			tb += '<td width="100px" align="right">' + currency2Digit(totalDischarge) + '&nbsp;</td>';
			tb += '<td width="60px"></td>';
			tb += '<td width="100px" align="right">' + currency2Digit(totalChargeRule) + '&nbsp;</td>';
			tb += '<td width="100px" align="right">' + currency2Digit(totalCompensation) + '&nbsp;</td>';
			tb += '<td width="100px" align="right" class="' + clazzDisComTotal + '">' + currency2Digit(totalDisComTotal) + '&nbsp;</td>';
			tb += '<td width="70px"></td>';
			tb += '<td width="120px"></td>';
			tb += '<td width="100px"></td>';
			tb += '<td width="70px"></td>';
			tb += '<td width="100px" align="right">' + currency2Digit(totalOrfHMain) + '&nbsp;</td>';
			tb += '<td width="100px" align="right">' + currency2Digit(totalOrfNHSO) + '&nbsp;</td>';
			tb += '<td width="100px" align="right">' + currency2Digit(totalSumHC) + '&nbsp;</td>';
			tb += '<td width="100px" align="right">' + currency2Digit(totalSumAE) + '&nbsp;</td>';
			tb += '<td width="100px" align="right">' + currency2Digit(totalSumINST) + '&nbsp;</td>';
			tb += '<td width="100px" align="right">' + currency2Digit(totalSumIP) + '&nbsp;</td>';										
			tb += '<td width="100px" align="right">' + currency2Digit(totalSumDMIS) + '&nbsp;</td>';
			tb += '<td width="100px" align="right">' + currency2Digit(totalSumOP) + '&nbsp;</td>';
			tb += '<td width="100px" align="right">' + currency2Digit(totalSumPA) + '&nbsp;</td>';
			tb += '<td width="100px" align="right">' + currency2Digit(totalSumDRUG) + '&nbsp;</td>';
			tb += '<td width="100px" align="right">' + currency2Digit(totalSumOT) + '&nbsp;</td>';

			if(countStatusA > 0){
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldTotal) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldSumHC) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldSumAE) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldSumINST) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldSumIP) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldSumDMIS) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldSumOP) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldSumPA) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldSumDRUG) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldSumOT) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalOldAmount) + '&nbsp;</td>';
				
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewDischarge) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewSumHC) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewSumAE) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewSumINST) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewSumIP) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewSumDMIS) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewSumOP) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewSumPA) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewSumDRUG) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewSumOT) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalNewCompensation) + '&nbsp;</td>';
				
				var tt = totalPay - totalReturn;
				if(tt < 0){
					totalReturn = totalReturn - totalPay;
					totalPay = 0;
				}else{
					totalReturn = 0;
					totalPay = tt;
				}
				
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalPay) + '&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">' + currency2Digit(totalReturn) + '&nbsp;</td>';
			}else{
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
				tb += '<td width="100px" align="right" class="hidden-table">&nbsp;</td>';
			}
			tb += '</tr>';
			}
			$("#detailData").css("display","block");
		}else{
			$("#detailData").css("display","block");
			tb = '<tr><td colspan="26" class="required">ไม่มีข้อมูล</td></tr>';
		}
		
		$("#tbBodyData tbody").html(tb);
		$('.hidden-table').hide();
	}
</script>

<style>
.amount {
	color: blue;
	text-align: right;
}
.hidden-table{
/* 	display:none */
}

</style>
</head>

<body>
	<!------------------- Header ------------------>
	<div class="panel">
		<jsp:include page="../include/header.jsp" />
	</div>
	<!--------------------------------------------->

	<div class="block-content">
		<!--<jsp:include page="../include/breadcrumb.jsp" />-->

		<div id="content" class="content-data">
			<div class="panel">
				<div class="panel-content text-center">
					<div style="margin-top: 5px;">
						ค้นหาจาก <select id="searchBy" style="width: 100px;height: 28px;font-size: 14px;">
							<option value="pid" selected="selected">PID</option>
							<option value="hn">HN</option>
							<option value="an">AN</option>
						</select> &nbsp;<input type="text" id="txtSearch">&nbsp;
						<c:choose>
							<c:when test='${USER.userType eq "Hospital"}'>
								หน่วยบริการ&nbsp;<input type="text" value="${USER.officeCode} - ${USER.officeName}" style="font-size: 14px;width:230px" disabled/><p>
							</c:when>
							<c:otherwise>
								รหัสหน่วยบริการ&nbsp;<input type="text" id="txtHospitalCode" maxlength="5"/>&nbsp;
								<input type="checkbox" id="chkDunnoCode"/>&nbsp;<font color="red">กรณีเลือกจากชื่อหน่วยบริการ</font><p>
								<div id="searchGroupHospital" style="display:none">
									เขต&nbsp;&nbsp;<select id="txtDataListZone" style="height: 28px;font-size: 14px;"></select>&nbsp;
									จังหวัด&nbsp;<select id="txtDataListProvince" style="height: 28px;font-size: 14px;"></select>&nbsp;
									หน่วยบริการ&nbsp;<select id="txtDataListHospital" style="height: 28px;"></select><p>
								</div>
							</c:otherwise>
						</c:choose>
							วันที่เข้ารับการรักษา&nbsp;<input type="text" id="txtFromDateAdmidTime" />
							&nbsp;ถึง&nbsp;<input type="text" id="txtToDateAdmidTime" /><p>
							<button id="btnSearch">ค้นหา</button>
					</div>
					<div id="detailData">
						<div>
							<span id="searchByValue"></span>&nbsp;<b id="pid"></b>&nbsp;&nbsp;
							<span id="searchByValueData">ชื่อ-นามสกุล&nbsp;<b id="fullname"></b></span>
						</div>
						<div>
							จำนวนรายการทั้งหมด&nbsp;<b id="countAll"></b>&nbsp;รายการ&nbsp;
							ผ่าน&nbsp;<font style="font-weight: bold; text-decoration: underline;" id="countPass"></font>&nbsp;รายการ&nbsp;
							อุทธรณ์&nbsp;<font style="font-weight: bold; text-decoration: underline;" id="countAppeal"></font>&nbsp;รายการ&nbsp;
							ไม่ผ่าน&nbsp;<font style="font-weight: bold; text-decoration: underline;" id="countNotPass"></font>&nbsp;รายการ&nbsp;
							ไม่เข้าเกณฑ์&nbsp;<font style="font-weight: bold; text-decoration: underline;" id="countNotPassDeny"></font>&nbsp;รายการ
						</div>
						<div style="float: left; margin: 1px;">
							<img alt="Export to Excel" src="${pageContext.request.contextPath}/images/file_xls.gif"
								class="pointer-cursor" title="Export to Excel" id="exportExcel">
							<span style="color: red; font-size: 14px; margin-left: 10px">
								*หมายเหตุ ORF=เบิกจ่ายจากต้นสังกัด</span>
						</div>
						<div style="float: right; margin: 1px;">
							<button id="show_table"><img width="12px" src="${pageContext.request.contextPath}/images/arrow_right.png" /> แสดงข้อมูลอุทธรณ์</button>
							<button id="hide_table"><img width="12px" src="${pageContext.request.contextPath}/images/arrow_left.png" /> ซ่อนข้อมูลอุทธรณ์</button>
						</div>
					</div>
					
					<div class="data-table" style="padding-right: 10px;">
						<table width="5380px" cellspacing="0" cellpadding="0"
							id="tbHeaderData" style="padding-right: 17px;">
							<thead id="thead1">
								<tr>
									<td rowspan="3" width="40px">ลำดับ</td>
									<td rowspan="3" width="100px">Tran Id</td>
									<td rowspan="3" width="100px">EClaim No</td>
									<td rowspan="3" width="70px">HN</td>
									<td rowspan="3" width="70px">AN</td>
									<td rowspan="3" width="70px">Rep No</td>
									<td rowspan="3" width="50px">OP/IP</td>
									<td rowspan="3" width="180px">โรงพยาบาล</td>
									<td rowspan="3" width="110px">วันที่เข้ารับการรักษา</td>
									<td rowspan="3" width="110px">วันที่จำหน่าย</td>
									<td rowspan="2" colspan="2">เงินเดือน</td>
									<td rowspan="3" width="100px">เรียกเก็บ&nbsp;(บาท)</td>
									<td rowspan="3" width="60px">สถานะ</td>
									<td rowspan="3" width="100px">ค่า พรบ.&nbsp;(บาท)</td>
									<td rowspan="3" width="100px">ชดเชย&nbsp;(บาท)</td>
									<td rowspan="3" width="100px">ส่วนต่างจากการเรียกเก็บ&nbsp;(บาท)</td>
									<td rowspan="3" width="70px">Batch Id</td>
									<td rowspan="3" width="120px">วันที่จ่าย</td>
									<td rowspan="3" width="100px">สถานะการเบิกจ่าย</td> 
									<td rowspan="3" width="70px">สิทธิ์การเบิก</td> 
									<td rowspan="2" colspan="2">OP&nbsp;REFER(NON&nbsp;HC)</td>
									<td colspan="9" rowspan="1">กองทุน&nbsp;(บาท)</td>
								</tr>
								<tr>
									<td>HC</td>
									<td>AE</td>
									<td>INST</td>
									<td>IP</td>
									<td>DMIS</td>
									<td>OP</td>
									<td>Prior<br>Authorize</td>
									<td>DRUG</td>
									<td>ON TOP</td>
								</tr>
								<tr>
									<td width="70px">ร้อยละ(%)</td>
									<td width="100px">จำนวนเงิน(บาท)</td>
									<td width="100px">HMAIN</td>
									<td width="100px">NHSO</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
								</tr>
							</thead>
							<thead id="thead2" style="display:none">
								<tr>
									<td rowspan="4" width="40px">ลำดับ</td>
									<td rowspan="4" width="100px">Tran Id</td>
									<td rowspan="4" width="100px">EClaim No</td>
									<td rowspan="4" width="70px">HN</td>
									<td rowspan="4" width="70px">AN</td>
									<td rowspan="4" width="70px">Rep No</td>
									<td rowspan="4" width="50px">OP/IP</td>
									<td rowspan="4" width="180px">โรงพยาบาล</td>
									<td rowspan="4" width="110px">วันที่เข้ารับการรักษา</td>
									<td rowspan="4" width="110px">วันที่จำหน่าย</td>
									<td rowspan="3" colspan="2">เงินเดือน</td>
									<td rowspan="4" width="100px">เรียกเก็บ&nbsp;(บาท)</td>
									<td rowspan="4" width="60px">สถานะ</td>
									<td rowspan="4" width="100px">ค่า พรบ.&nbsp;(บาท)</td>
									<td rowspan="4" width="100px">ชดเชย&nbsp;(บาท)</td>
									<td rowspan="4" width="100px">ส่วนต่างจากการเรียกเก็บ&nbsp;(บาท)</td>
									<td rowspan="4" width="70px">Batch Id</td>
									<td rowspan="4" width="120px">วันที่จ่าย</td>
									<td rowspan="4" width="100px">สถานะการเบิกจ่าย</td> 
									<td rowspan="4" width="70px">สิทธิ์การเบิก</td> 
									<td rowspan="3" colspan="2">OP&nbsp;REFER(NON&nbsp;HC)</td>
									<td colspan="9" rowspan="2">กองทุน&nbsp;(บาท)</td>
									<td colspan="24">ข้อมูลอุทธรณ์</td>
								</tr>
								<tr >
									<td colspan="11" width="300px">ข้อมูลเดิม</td>
									<td colspan="11" width="300px">ข้อมูลใหม่</td>
									<td colspan="2" width="200px">ชดเชยสุทธิ</td>
								</tr>
								<tr>
									<td>HC</td>
									<td>AE</td>
									<td>INST</td>
									<td>IP</td>
									<td>DMIS</td>
									<td>OP</td>
									<td>Prior<br>Authorize</td>
									<td>DRUG</td>
									<td>ON TOP</td>
									<!-- Appeal -->
									<td rowspan="2" width="100px" >เรียกเก็บ(บาท)</td>
									<td >HC</td>
									<td >AE</td>
									<td >INST</td>
									<td >IP</td>
									<td >DMIS</td>
									<td >OP</td>
									<td>Prior<br>Authorize</td>
									<td>DRUG</td>
									<td>ON TOP</td>
									<td rowspan="2" width="100px" >จ่ายชดเชย</td>
									<td rowspan="2" width="100px" >เรียกเก็บ(บาท)</td>
									<td >HC</td>
									<td >AE</td>
									<td >INST</td>
									<td >IP</td>
									<td >DMIS</td>
									<td >OP</td>
									<td>Prior<br>Authorize</td>
									<td>DRUG</td>
									<td>ON TOP</td>
									<td rowspan="2" width="100px" >จ่ายชดเชย</td>
									<td width="100px" rowspan="2" >จ่ายเพิ่ม</td>
									<td width="100px" rowspan="2" >เรียกคืน</td>
								</tr>
								<tr>
									<td width="70px">ร้อยละ(%)</td>
									<td width="100px">จำนวนเงิน(บาท)</td>
									<td width="100px">HMAIN</td>
									<td width="100px">NHSO</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<!-- Appeal -->
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>

									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
									<td width="100px">สปสช.จ่าย</td>
								</tr>
							</thead>
						</table>

						<div style="overflow-y: auto; overflow-x: hidden; position: absolute; height: 390px;" id="tbValueData">
							<table width="5380px" cellspacing="0" cellpadding="0" id="tbBodyData" style="padding-right: 17px;margin-top: -38px">							
								<thead>
									<tr>
										<td width="40px">ลำดับ</td>
										<td width="100px">Tran Id</td>
										<td width="100px">EClaim No</td>
										<td width="70px">HN</td>
										<td width="70px">AN</td>
										<td width="70px">Rep No</td>
										<td width="50px">OP/IP</td>
										<td width="180px">โรงพยาบาล</td>
										<td width="110px">วันที่เข้ารับการรักษา</td>
										<td width="110px">วันที่จำหน่าย</td>
										<td width="70px">ร้อยละ(%)</td>
										<td width="100px">จำนวนเงิน(บาท)</td>
										<td width="100px">เรียกเก็บ&nbsp;(บาท)</td>
										<td width="60px">สถานะ</td>
										<td width="100px">ค่า พรบ.&nbsp;(บาท)</td>
										<td width="100px">ชดเชย&nbsp;(บาท)</td>
										<td width="100px">ส่วนต่างจากการเรียกเก็บ&nbsp;(บาท)</td>
										<td width="70px">Batch Id</td>
										<td width="120px">วันที่จ่าย</td>
										<td width="100px">สถานะการเบิกจ่าย</td> 
										<td width="70px">สิทธิ์การเบิก</td> 
										<td width="100px">HMAIN</td>
										<td width="100px">NHSO</td>
										<td width="100px">สปสช.จ่าย</td>
										<td width="100px">สปสช.จ่าย</td>
										<td width="100px">สปสช.จ่าย</td>
										<td width="100px">สปสช.จ่าย</td>
										<td width="100px">สปสช.จ่าย</td>
										<td width="100px">สปสช.จ่าย</td>
										<td width="100px">สปสช.จ่าย</td>
										<td width="100px">สปสช.จ่าย</td>
										<td width="100px">สปสช.จ่าย</td>
										<!-- Appeal -->
										<td width="100px" class="hidden-table">เรียกเก็บ(บาท)</td>
										<td width="100px" class="hidden-table">สปสช.จ่าย</td>
										<td width="100px" class="hidden-table">สปสช.จ่าย</td>
										<td width="100px" class="hidden-table">สปสช.จ่าย</td>
										<td width="100px" class="hidden-table">สปสช.จ่าย</td>
										<td width="100px" class="hidden-table">สปสช.จ่าย</td>
										<td width="100px" class="hidden-table">สปสช.จ่าย</td>
										<td width="100px" class="hidden-table">สปสช.จ่าย</td>
										<td width="100px" class="hidden-table">สปสช.จ่าย</td>
										<td width="100px" class="hidden-table">สปสช.จ่าย</td>
										<td width="100px" class="hidden-table">จ่ายชดเชย</td>
										<td width="100px" class="hidden-table">เรียกเก็บ(บาท)</td>
										<td width="100px" class="hidden-table">สปสช.จ่าย</td>
										<td width="100px" class="hidden-table">สปสช.จ่าย</td>
										<td width="100px" class="hidden-table">สปสช.จ่าย</td>
										<td width="100px" class="hidden-table">สปสช.จ่าย</td>
										<td width="100px" class="hidden-table">สปสช.จ่าย</td>
										<td width="100px" class="hidden-table">สปสช.จ่าย</td>
										<td width="100px" class="hidden-table">สปสช.จ่าย</td>
										<td width="100px" class="hidden-table">สปสช.จ่าย</td>
										<td width="100px" class="hidden-table">สปสช.จ่าย</td>
										<td width="100px" class="hidden-table">จ่ายชดเชย</td>
										<td width="100px" class="hidden-table">จ่ายเพิ่ม</td>
										<td width="100px" class="hidden-table">เรียกคืน</td>
									</tr>
								</thead>
								<tbody>
								</tbody>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>


</body>
</html>
